<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:body onload="foco();">
	<ui:composition template="../template.xhtml">
		<ui:define name="miolo">
		    <p:growl id="erros"/>
			<h:form id="LSProject">
				<p:panel id="panel" header="#{msgs.maintenanceProjects}">
					<table width="100%">
						<tr valign="middle">
							<td width="40px" align="left"><p:commandButton
									value="#{msgs.register}" action="#{projectFrm.register}" />
							</td>
						</tr>
					</table>
					<table>
						<tr>
							<td><h:outputText value="#{msgs.name}" /></td>
							<td><p:inputText id="nameSearch" value="#{projectFrm.name}"
									size="40" /></td>
							<td><p:commandButton image="ui-icon-search"
									value="#{msgs.search}" action="#{projectFrm.search}"
									update="nameSearch,erros,tabela" /></td>
						</tr>
					</table>
					<table width="100%">
						<tr>
							<td>
								<h:panelGrid style="width:100%">
									<p:dataTable value="#{projectFrm.collection}"
										emptyMessage="#{msgs.naoHaDados}" id="tabela" var="item"
										rows="5" paginator="true" paginatorPosition="top"
										liveScroll="true">

										<p:column headerText="#{msgs.actionColumn}">
											<p:commandButton title="#{msgs.changeRecord}"
												action="#{projectFrm.update}"
												image="ui-icon ui-icon-arrowrefresh-1-w" />
											<f:verbatim>&nbsp;</f:verbatim>
											<p:commandButton title="#{msgs.deleteRegistry}"
												actionListener="#{projectFrm.remove}" image="ui-icon-trash"
												onclick="if(!window.confirm('Confirma exclusão de registro?')){foco();return false;}"
												update="tabela,erros" />
											<f:verbatim>&nbsp;</f:verbatim>
										</p:column>

										<p:column sortBy="#{item.nome}" headerText="#{msgs.nameColumn}">
											<h:outputText value="#{item.nome}" />
										</p:column>

										<p:column sortBy="#{item.data}" headerText="#{msgs.dateColumn}">
											<h:outputText value="#{item.data}">
												<f:convertDateTime
													locale="#{facesContext.externalContext.request.locale}" />
											</h:outputText>
										</p:column>

										<p:column sortBy="#{item.situacao}" headerText="#{msgs.situationColumn}">
											<h:outputText
												value="#{item.situacao == '1' ? 'ATIVO':'INATIVO'}" />
										</p:column>

									</p:dataTable>
								</h:panelGrid>
							</td>
						</tr>
					</table>
				</p:panel>
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>


